package com.game.entity.player;

import org.springframework.data.annotation.Id;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.game.entity.req.BaseReq;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
public class Player {

	@Id
	@JsonProperty("UserID")
	private String userId;
	private String userName;// 玩家名字
	private long createTime;
	private long loginTime;
	private long saveTime;
	private String platform;// 平台
	private String channel;// 渠道
	private String version;// 版本
	private String ip;
	private PlayerClientData playerClientData;

	public Player() {

	}

	public Player(String userId,String ip, BaseReq baseReq) {
		long now = System.currentTimeMillis();
		this.ip = ip;
		this.createTime = now;
		this.loginTime = now;
		this.saveTime = now;
		this.userId = userId;
		this.platform = baseReq.getParam("Platform");
		this.channel = baseReq.getParam("Channel");
		this.version = baseReq.getParam("Version");
	}

}
